# -*- coding: cp949 -*-
loopFlag = 1
from internetbook import *

#### Menu  implementation
def printMenu():
    print("\nMovie Search Program")
    print("========Menu==========")
    print("Quit program:   q")
    print("Get data from keyword: k")
    print("Get data from director: d")
    print("========Menu==========")
    
def launcherFunction(menu):
    if menu == 'q':
        QuitMovieMgr()
    elif menu == 'k':
        keyword = str(input ('input keyword to search :'))
        ret = getMovieDataFromKeyword(keyword)
    elif menu == 'd': 
        director = str(input ('input director to get :'))
        ret = getMovieDataFromDirector(director.decode())  
    else:
        print ("error : unknow menu key")

def QuitMovieMgr():
    global loopFlag
    loopFlag = 0
    MovieFree()
    
##### run #####
while(loopFlag > 0):
    printMenu()
    menuKey = str(input ('select menu :'))
    launcherFunction(menuKey)
else:
    print ("Thank you! Good Bye")
